package com.cooper.mediadb.local;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.view.WindowManager;

import com.cooper.mediadb.Media;
import com.cooper.mediadb.MediaBrowseBaseFragment;
import com.cooper.scrapemedialib.R;
import com.cooper.scraper.show.GalleryFanartShowBuilder;
public abstract class LocalMediaFragment<T extends LocalMedia> extends
		MediaBrowseBaseFragment<T> {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		fanartsShowBuilder = new LocalGalleryShowBuild<T>(getActivity()
				.getApplicationContext(), getActivity().getWindowManager(),
				getResources().getDimensionPixelSize(R.dimen.custombar_height));
	}

	@Override
	public void onFullWatingCanceled() {
	}

	@Override
	protected void showMediaDetails(T media) {
		currentMedia = media;

		LocalMediaInfoDialog<T> mediaInfoDialog = new LocalMediaInfoDialog<T>();
		FragmentManager fm = getActivity().getSupportFragmentManager();
		mediaInfoDialog.show(fm, "MEDIA_INFO_DIALOG");
	}
	
	
	public class LocalGalleryShowBuild<T extends LocalMedia> extends GalleryFanartShowBuilder<T> {

		public LocalGalleryShowBuild(Context context, WindowManager windownManager,
				int holderHeight) {
			super(context, windownManager, holderHeight);
		}

		@Override
		public void buildFanartViewStrategy() {
			fanartViewStrategy = new LocalFanartViewStrategy<T>(context);
			
		}

		@Override
		protected float getFanartWHScale() {
			return Media.HEIGHT_WIDHT_SCALE;
		}

	}

}
